/*
	TUIO C# Demo - part of the reacTIVision project
	http://reactivision.sourceforge.net/

	Copyright (c) 2005-2009 Martin Kaltenbrunner <mkalten@iua.upf.edu

	This program is free software; you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation; either version 2 of the License, or
	(at your option) any later version.

	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with this program; if not, write to the Free Software
	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/

using System;
using System.Drawing;
using System.Windows.Forms;
using System.ComponentModel;
using System.Collections.Generic;
using System.Collections;
using System.Threading;
using SpeechLib;


using TUIO;

public class SonificationUI : Form, TuioListener
{
    private Hashtable objects;

    private Bitmap img;
    private TuioClient client;
    private Dictionary<long, TuioDemoObject> objectList;
    private Dictionary<long, TuioCursor> cursorList;
    private List<SuperPoint> nodes;
    private object cursorSync = new object();
    private object objectSync = new object();

    public static int width, height;
    private int window_width = 1250;
    private int window_height = 650;
    private int window_left = 0;
    private int window_top = 0;
    private int screen_width = Screen.PrimaryScreen.Bounds.Width;
    private int screen_height = Screen.PrimaryScreen.Bounds.Height;

    private bool fullscreen;
    private bool verbose;

    SolidBrush blackBrush = new SolidBrush(Color.Black);
    SolidBrush redBrush = new SolidBrush(Color.Red);
    SolidBrush cyanBrush = new SolidBrush(Color.Cyan);
    SolidBrush whiteBrush = new SolidBrush(Color.White);

    SolidBrush grayBrush = new SolidBrush(Color.Gray);
    private PictureBox prevPictureBox;
    private Graphics globalG;
    private PictureBox imagePictureBox;
    private PictureBox nextPictureBox;
    //private Panel panel1;
    private TransparentPanel drawPanel;
    Pen fingerPen = new Pen(new SolidBrush(Color.White), 1);

    private SonificationThread st;

    private ConvexHull ch;


    public SonificationUI(int port)
    {
        InitializeComponent();
        verbose = true;
        fullscreen = false;
        width = window_width;
        height = window_height;
        int id = 0;

        this.ClientSize = new System.Drawing.Size(width, height);
        this.Name = "TuioDemo";
        this.Text = "TuioDemo";

        this.Closing += new CancelEventHandler(Form_Closing);
        this.KeyDown += new KeyEventHandler(Form_KeyDown);

        this.SetStyle(ControlStyles.AllPaintingInWmPaint |
                        ControlStyles.UserPaint |
                        ControlStyles.DoubleBuffer, true);

        this.st = new SonificationThread();
        objectList = new Dictionary<long, TuioDemoObject>(128);
        cursorList = new Dictionary<long, TuioCursor>(128);

        client = new TuioClient(port);
        client.addTuioListener(this);
        client.connect();

        img = new Bitmap(Image.FromFile("1_12_s_GT.bmp"), imagePictureBox.Width, imagePictureBox.Height);

        objects = new Hashtable();
        objects.Add("0,0,0", "Nothing");
        objects.Add("0,128,0", "Grass");
        objects.Add("0,0,128", "Cow");


        imagePictureBox.Image = img;
        prevPictureBox.Image = Image.FromFile("PreviousArrow.png");
        nextPictureBox.Image = Image.FromFile("NextArrow.png");
        imagePictureBox.SizeChanged += new EventHandler(imagePictureBox_SizeChanged);


        drawPanel.SizeChanged += new EventHandler(drawPanel_SizeChanged);

        //nodes = new List<SuperPoint>();    // old code

        //new code,  
        nodes = new List<SuperPoint>();

        Console.WriteLine(cursorList.Values.Count);

        foreach (TuioCursor TC in cursorList.Values)
        {
            
            Console.WriteLine("\t X-value " + TC.getX()+" Y-value "+ TC.getY());
            Console.WriteLine("\t X-value " + TC.getX() + " Y-value " + TC.getY());
            Console.WriteLine("\t X-value " + TC.getX() + " Y-value " + TC.getY());
            Console.WriteLine("\t X-value " + TC.getX() + " Y-value " + TC.getY());
            Console.WriteLine("\t X-value " + TC.getX() + " Y-value " + TC.getY());
            Console.WriteLine("\t X-value " + TC.getX() + " Y-value " + TC.getY());
            Console.WriteLine("\t X-value " + TC.getX() + " Y-value " + TC.getY());
            nodes.Add(new SuperPoint(new PointF(TC.getX(), TC.getY()), 1));
        }

        //Console.WriteLine();
        // Take coordinates from TUIOCursor (x,y)
        // Make a new PointF object
        //nodes.Add(new SuperPoint(PointF))



        //nodes.Add(new SuperPoint(new PointF(310, 50), 1));
        //nodes.Add(new SuperPoint(new PointF(340, 35), 1));
        /*nodes.Add(new SuperPoint(new PointF(420, 20), 1));
        nodes.Add(new SuperPoint(new PointF(450, 30), 1));
        nodes.Add(new SuperPoint(new PointF(340, 80), 1));*/

        this.globalG = drawPanel.CreateGraphics();
        //nodes.Add(new SuperPoint(new PointF(210, 80), 1));
        //nodes.Add(new SuperPoint(new PointF(210, 480), 1));
        //nodes.Add(new SuperPoint(new PointF(610, 280), 1));

        //    ch.prepareNewConvexHull();        
        //this.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint, true);
    }

    public List<PointF> doConvexHull()
    {

        ch.InitOrderdPoints(nodes);
        return ch.Compute(nodes);
    }
    void drawPanel_SizeChanged(object sender, EventArgs e)
    {
        //MessageBox.Show("A");
        //drawPanel.Size = this.Size;
        //        doConvexHull(drawPanel.CreateGraphics());
        //drawGraphics = drawPanel.CreateGraphics();

    }

    public delegate void handleImageTouchDelegate(Graphics g, TuioCursor tcur, int x, int y);

    public String getObjectAt(float x, float y)
    {
        if (img == null)
            return "";
        float img_x = x - prevPictureBox.Size.Width;
        float img_y = y;
        if (img_x >= img.Width || img_y >= img.Height || img_x < 0 || img_y < 0)
        {
            Console.WriteLine("ERROR: " + (img_x + " > " + img.Width + " || " + y + " > " + img.Height));
            return "error";
        }
        Color c = img.GetPixel((int)img_x, (int)img_y);

        Object obj = objects[c.R + "," + c.G + "," + c.B];
        //Console.Write("before1");
        String str = "nothing";
        if (obj != null)
            str = obj.ToString();
        return str;
    }
    public void handleImageTouch(Graphics g, TuioCursor tcur, int x, int y)
    {
        if (this.imagePictureBox.InvokeRequired)
        {
            this.imagePictureBox.Invoke(new handleImageTouchDelegate(this.handleImageTouch), g, tcur, x, y);
            return;
        }
        Console.WriteLine("Touched at " + x + ", " + y);
        Font font = new Font("Arial", 10.0f);
        //int img_x = (int)(x * (double)img.Width / width);
        //int img_y = (int)(y * (double)img.Height / height);

        if (img == null) return;
        String str = getObjectAt(x, y);

        //Color c = img.GetPixel((int)img_x, (int)img_y);
        //this.globalG.DrawString(tcur.getCursorID() + " - " + c.R + ", " + c.G + ", " + c.B, font, blackBrush, new PointF(tcur.getScreenX(width) - 10, tcur.getScreenY(height) - 10));
        this.globalG.DrawString(tcur.getCursorID() + " - " + x + "," + y, font, blackBrush, new PointF(tcur.getScreenX(width) - 10, tcur.getScreenY(height) - 10));
        //Graphics g = imagePictureBox.CreateGraphics();
        //imagePictureBox.Invalidate();
        this.globalG.DrawString(tcur.getCursorID() + " - " + str, font, whiteBrush, new PointF(x - 10, y - 10));
        Console.WriteLine("Inside handleImageTouch = " + tcur.getCursorID());
        st.speak(str);
        //spVoice.Speak(str, svsp);

    }

    public void handlePrevButtonTouch(int x, int y)
    {
        prevPictureBox.Refresh();
        st.speak("Previous Image");
    }

    public void handleNextButtonTouch(int x, int y)
    {

        nextPictureBox.Refresh();
        st.speak("Next Image");
    }
    // handle resize of windows form
    delegate void imagePictureBox_SizeChangedDelegate(object sender, EventArgs e);
    void imagePictureBox_SizeChanged(object sender, EventArgs e)
    {
        if (this.imagePictureBox.InvokeRequired)
        {
            this.imagePictureBox.Invoke(new imagePictureBox_SizeChangedDelegate(this.imagePictureBox_SizeChanged), sender, e);
            return;
        }

        Image image = Image.FromFile("1_12_s_GT.bmp");
        int width = imagePictureBox.Width;
        int height = imagePictureBox.Height;
        if (width > 0 && height > 0)
        {
            //Console.WriteLine("Image Dimensions wxh: " + img.Width + "x" + img.Height);
            //Console.WriteLine("PictureBox Dimensions wxh: " + imagePictureBox.Width + "x" + imagePictureBox.Height);
            //Console.WriteLine("Previous Button Dim wxh: " + prevPictureBox.Width + "x" + prevPictureBox.Height);
            img = new Bitmap(image, new Size(width, height));
        }

        imagePictureBox.Image = img;
        //        doConvexHull(drawPanel.CreateGraphics());
        //throw new NotImplementedException();
    }

    private void Form_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
    {

        if (e.KeyData == Keys.F1)
        {
            if (fullscreen == false)
            {

                width = screen_width;
                height = screen_height;

                window_left = this.Left;
                window_top = this.Top;

                this.FormBorderStyle = FormBorderStyle.None;
                this.Left = 0;
                this.Top = 0;
                this.Width = screen_width;
                this.Height = screen_height;

                fullscreen = true;
            }
            else
            {

                width = window_width;
                height = window_height;

                this.FormBorderStyle = FormBorderStyle.Sizable;
                this.Left = window_left;
                this.Top = window_top;
                this.Width = window_width;
                this.Height = window_height;

                fullscreen = false;
            }
        }
        else if (e.KeyData == Keys.Escape)
        {
            this.Close();

        }
        else if (e.KeyData == Keys.V)
        {
            verbose = !verbose;
        }

    }

    private void Form_Closing(object sender, System.ComponentModel.CancelEventArgs e)
    {
        client.removeTuioListener(this);

        client.disconnect();
        System.Environment.Exit(0);
    }

    public void addTuioObject(TuioObject o)
    {
        lock (objectSync)
        {
            objectList.Add(o.getSessionID(), new TuioDemoObject(o));
        } if (verbose) Console.WriteLine("add obj " + o.getSymbolID() + " (" + o.getSessionID() + ") " + o.getX() + " " + o.getY() + " " + o.getAngle());
    }

    public void updateTuioObject(TuioObject o)
    {

        lock (objectSync)
        {
            objectList[o.getSessionID()].update(o);
        }
        if (verbose) Console.WriteLine("set obj " + o.getSymbolID() + " " + o.getSessionID() + " " + o.getX() + " " + o.getY() + " " + o.getAngle() + " " + o.getMotionSpeed() + " " + o.getRotationSpeed() + " " + o.getMotionAccel() + " " + o.getRotationAccel());
    }

    public void removeTuioObject(TuioObject o)
    {
        lock (objectSync)
        {
            objectList.Remove(o.getSessionID());
        }
        if (verbose) Console.WriteLine("del obj " + o.getSymbolID() + " (" + o.getSessionID() + ")");
    }

    public void addTuioCursor(TuioCursor c)
    {
        lock (cursorSync)
        {
            cursorList.Add(c.getSessionID(), c);
        }
        if (verbose) Console.WriteLine("add cur " + c.getCursorID() + " (" + c.getSessionID() + ") " + c.getX() + " " + c.getY());
    }
    delegate void refreshAllDelegate();
    public void refreshAll()
    {
        if (this.imagePictureBox.InvokeRequired)
        {
            this.imagePictureBox.Invoke(new refreshAllDelegate(this.refreshAll));
            return;
        }
        if (verbose)
            Console.WriteLine("Refreshing all picture boxes...");
        drawPanel.Invalidate();
        imagePictureBox.Invalidate();
        this.Invalidate();
        //nextPictureBox.Refresh();
        //prevPictureBox.Refresh();

    }
    public void updateTuioCursor(TuioCursor c)
    {
        if (verbose) Console.WriteLine("set cur " + c.getCursorID() + " (" + c.getSessionID() + ") " + c.getX() + " " + c.getY() + " " + c.getMotionSpeed() + " " + c.getMotionAccel());
        refreshAll();
    }

    public void removeTuioCursor(TuioCursor c)
    {
        lock (cursorSync)
        {
            cursorList.Remove(c.getSessionID());

        }
        refreshAll();
        if (verbose) Console.WriteLine("del cur " + c.getCursorID() + " (" + c.getSessionID() + ")");
    }

    public void refresh(TuioTime frameTime)
    {
        //Invalidate();
        // doConvexHull(drawPanel.CreateGraphics());
    }

    /// <summary>
    /// Get the line segments that intersect with the pt</summary>
    /// <returns>
    /// Returns an array of line segments (from the list provided) that intersect with the given point.</returns>
    /// 
    /// <param name="segs"> 
    /// The list of line segments to check for an intersection.</param>
    /// <param name="pt">
    /// The point to check intersection for.</param>
    ///
    private Segment[] getIntersections(List<Segment> segs, PointF pt)
    {
        List<Segment> intList = new List<Segment>();

        // Iterate through all segments in the polygon (the shape formed by the hand when placed on the glass)
        foreach (Segment seg in segs)
        {
            //Console.WriteLine("Does " + seg.q.ToString() + " - " + seg.p.ToString() + " have " + pt.ToString());

            // check whether this segment has thius particular point
            if (seg.hasPoint(pt))
                intList.Add(seg);
        }

        // turn the results into an array
        Segment[] ret = new Segment[intList.Count];
        for (int i = 0; i < intList.Count; i++)
        {
            ret[i] = intList[i];
        }
        return ret; ;
    }

    /// <summary>
    /// Do a search for the objects inside the polygon defined by the current points.
    /// </summary>
    public void doPolygonObjectSearch()
    {
        List<PointF> points = doConvexHull(); // points in the convex hull
        List<Segment> segments = ch.getSegments(); // the line segments that are in this polygon


        if (segments.Count == 0) return;

        float minX, maxX;
        float minY, maxY;

       
        // find the min/max X and Y coordinates for scanline
        minX = maxX = segments[0].p.X;
        minY = maxY = segments[0].p.Y;

        foreach (Segment seg in segments)
        {
            if (seg.p.X < minX)
                minX = seg.p.X;
            if (seg.p.Y < minY)
                minY = seg.p.Y;
            if (seg.p.X > maxX)
                maxX = seg.p.X;
            if (seg.p.Y > maxY)
                maxY = seg.p.Y;

            if (seg.q.X < minX)
                minX = seg.q.X;

            if (seg.q.Y < minY)
                minY = seg.q.Y;
            if (seg.q.X > maxX)
                maxX = seg.q.X;
            if (seg.q.Y > maxY)
                maxY = seg.q.Y;

        }
        Console.WriteLine("Min/Max X: " + minX + " - " + maxX);
        Console.WriteLine("Min/Max Y: " + minY + " - " + maxY);


        // now begin searching the rectangle we've obtained via the min/max coordinates
        bool inPoly = false; // the toggle to determine whether we are in the polygon or not
        bool red = false;
        HashSet<String> objects = new HashSet<String>(); // objects we've found in the polygon so far

        for (float y = minY; y < maxY; y++)
        {
            inPoly = false; // reset toggle every new y
            red = false;
            for (float x = minX; x < maxX; x++)
            {
                Segment[] intersections = getIntersections(segments, new PointF(x, y));

                if (intersections.Length != 0)
                {
                    Console.WriteLine("Intersections at " + x + ", " + y + ": ");
                    foreach (Segment i in intersections)
                        Console.WriteLine("\t" + i.p.ToString() + " - " + i.q.ToString());
                }
                if (intersections.Length > 0)
                {
                    objects.Add(getObjectAt(x, y));
                    img.SetPixel((int)(x - prevPictureBox.Size.Width), (int)y, Color.Red);
                    if (!inPoly)
                        red = true;
                    else
                        red = false;
                }
                else if (red && y != maxY && y != minY)
                {
                    img.SetPixel((int)(x - prevPictureBox.Size.Width), (int)y, Color.Red);
                    inPoly = true;
                }
                else
                {
                    img.SetPixel((int)(x - prevPictureBox.Size.Width), (int)y, Color.White);
                }

            }
            //if (y - minY >= 3)
            //break;

        }

        foreach (String obj in objects)
        {
            Console.WriteLine("Found: " + obj);
        }

        //Segment seg = segments[0];

        //MessageBox.Show(""+seg.contains(points[0]));

    }

    protected delegate void OnPaintBackgroundDelegate(PaintEventArgs pevent);
    protected override void OnPaintBackground(PaintEventArgs pevent)
    {


        if (verbose)
            Console.WriteLine("called onPaintBackground()");
        if (this.imagePictureBox.InvokeRequired)
        {

            if (verbose)
                Console.WriteLine("onPaintBackground(): delegating");
            this.imagePictureBox.Invoke(new OnPaintBackgroundDelegate(this.OnPaintBackground), pevent);
            return;

        }

        // Getting the graphics object
        //Graphics g = pevent.Graphics;
        //Graphics g = drawPanel.CreateGraphics();

        Graphics g = globalG;
        //Graphics g = pevent.Graphics;

        if (g == null)
        {
            if (verbose)
                Console.WriteLine("onPaintBackground(): no graphics object found");
            //MessageBox.Show("no g"); 
            return;
        }
        //g.DrawImage(img, ClientRectangle);
        //g.FillRectangle(whiteBrush, new Rectangle(0,0,width,height));

        //g = drawPanel.CreateGraphics();



        ch = new ConvexHull(null);
        List<PointF> points = doConvexHull();
        doPolygonObjectSearch();
        Point[] pts = new Point[points.Count];
        for (int i = 0; i < pts.Length; i++)
            pts[i] = new Point((int)points[i].X, (int)points[i].Y);



        // draw the cursor path
        if (cursorList.Count > 0)
        {
            lock (cursorSync)
            {
                foreach (TuioCursor tcur in cursorList.Values)
                {
                    List<TuioPoint> path = tcur.getPath();
                    TuioPoint current_point = path[0];
                    TuioPoint last_point = path[path.Count - 1];
                    width = this.Size.Width;
                    height = this.Size.Height;
                    Font font = new Font("Arial", 10.0f);


                    int x = last_point.getScreenX(width) - height / 100;
                    int y = last_point.getScreenY(height) - height / 100;

                    float tempFloatX = tcur.getX();
                    float tempFloatY = tcur.getY();
                    Brush brush = grayBrush;
                    if (tcur.getY() < 0)
                        tempFloatY = 0;
                    if (tcur.getX() < 0)
                        tempFloatX = 0;


                    nodes.Add(new SuperPoint(new PointF(tempFloatX, tempFloatY), 1));

                    if (prevPictureBox.Location.X < x && (prevPictureBox.Location.X + prevPictureBox.Width) >= x
                        && prevPictureBox.Location.Y < y && (prevPictureBox.Location.Y + prevPictureBox.Height) >= y)
                    {
                        //prev button
                        //g = prevPictureBox.CreateGraphics();
                        // g = drawPanel.CreateGraphics();
                        brush = cyanBrush;
                        handlePrevButtonTouch(x, y);
                        //MessageBox.Show("Prev Button Event");
                    }
                    else if (imagePictureBox.Location.X < x && (imagePictureBox.Location.X + imagePictureBox.Width) >= x
                         && imagePictureBox.Location.Y < y && (imagePictureBox.Location.Y + imagePictureBox.Height) >= y)
                    {
                        Console.WriteLine("Image touched\r\n");
                        //g = drawPanel.CreateGraphics();
                        brush = redBrush;
                        handleImageTouch(g, tcur, x, y);
                        //MessageBox.Show("Image Event");

                    }
                    else if (nextPictureBox.Location.X < x && (nextPictureBox.Location.X + nextPictureBox.Width) >= x
                        && nextPictureBox.Location.Y < y && (nextPictureBox.Location.Y + nextPictureBox.Height) >= y)
                    {
                        brush = whiteBrush;
                        //g = drawPanel.CreateGraphics();
                        handleNextButtonTouch(x, y);
                        //MessageBox.Show("Next Button Event");
                    }
                    else
                    {
                        //MessageBox.Show("No event handler");
                    }

                    // scale the x,y to the current window size
                    for (int i = 0; i < path.Count; i++)
                    {
                        TuioPoint next_point = path[i];
                        g.DrawLine(fingerPen, current_point.getScreenX(width), current_point.getScreenY(height), next_point.getScreenX(width), next_point.getScreenY(height));
                        current_point = next_point;
                    }
                    g.FillEllipse(brush, current_point.getScreenX(width) - height / 100, current_point.getScreenY(height) - height / 100, height / 50, height / 50);


                }
            }
        }

        // draw the objects
        if (objectList.Count > 0)
        {
            lock (objectSync)
            {
                foreach (TuioDemoObject tobject in objectList.Values)
                {
                    tobject.paint(g);
                }
            }
        }
        if (pts.Length > 0)
            g.FillPolygon(redBrush, pts);
        //pevent.Graphics.FillPolygon(redBrush, pts);
        //globalG.FillPolygon(redBrush, pts);
        //Console.WriteLine("draw polygon");
        //doConvexHull(g);
        /*
        */
    }

    public static void Main(String[] argv)
    {
        int port = 0;
        switch (argv.Length)
        {
            case 1:
                port = int.Parse(argv[0], null);
                if (port == 0) goto default;
                break;
            case 0:
                port = 3333;
                Console.WriteLine("Im connecting to 3333 like a G6 :)");
                break;
            default:
                Console.WriteLine("usage: java TuioDemo [port]");
                System.Environment.Exit(0);
                break;
        }

        SonificationUI app = new SonificationUI(port);
        Application.Run(app);

    }

    private void InitializeComponent()
    {
        this.prevPictureBox = new DBPictureBox();
        this.imagePictureBox = new DBPictureBox();
        this.nextPictureBox = new DBPictureBox();
        this.drawPanel = new TransparentPanel();

        ((System.ComponentModel.ISupportInitialize)(this.prevPictureBox)).BeginInit();
        ((System.ComponentModel.ISupportInitialize)(this.imagePictureBox)).BeginInit();
        ((System.ComponentModel.ISupportInitialize)(this.nextPictureBox)).BeginInit();
        this.SuspendLayout();
        // 
        // prevPictureBox
        // 
        this.prevPictureBox.Location = new System.Drawing.Point(0, -1);
        this.prevPictureBox.Name = "prevPictureBox";
        this.prevPictureBox.Size = new System.Drawing.Size(301, 301);
        this.prevPictureBox.TabIndex = 1;
        this.prevPictureBox.TabStop = false;
        // 
        // imagePictureBox
        // 
        this.imagePictureBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                    | System.Windows.Forms.AnchorStyles.Left)
                    | System.Windows.Forms.AnchorStyles.Right)));
        this.imagePictureBox.Location = new System.Drawing.Point(302, -1);
        this.imagePictureBox.Name = "imagePictureBox";
        this.imagePictureBox.Size = new System.Drawing.Size(356, 287);
        this.imagePictureBox.TabIndex = 2;
        this.imagePictureBox.TabStop = false;
        // 
        // nextPictureBox
        // 
        this.nextPictureBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
        this.nextPictureBox.Location = new System.Drawing.Point(657, -1);
        this.nextPictureBox.Name = "nextPictureBox";
        this.nextPictureBox.Size = new System.Drawing.Size(301, 301);
        this.nextPictureBox.TabIndex = 0;
        this.nextPictureBox.TabStop = false;
        // 
        // drawPanel
        // 
        this.drawPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                    | System.Windows.Forms.AnchorStyles.Left)
                    | System.Windows.Forms.AnchorStyles.Right)));
        this.drawPanel.Location = new System.Drawing.Point(0, -1);
        this.drawPanel.Name = "drawPanel";
        this.drawPanel.Size = new System.Drawing.Size(958, 326);
        this.drawPanel.TabIndex = 3;
        // 
        // SonificationUI
        // 
        this.ClientSize = new System.Drawing.Size(957, 325);
        this.Controls.Add(this.drawPanel);
        this.Controls.Add(this.imagePictureBox);
        this.Controls.Add(this.nextPictureBox);
        this.Controls.Add(this.prevPictureBox);
        this.DoubleBuffered = true;
        this.Name = "SonificationUI";
        ((System.ComponentModel.ISupportInitialize)(this.prevPictureBox)).EndInit();
        ((System.ComponentModel.ISupportInitialize)(this.imagePictureBox)).EndInit();
        ((System.ComponentModel.ISupportInitialize)(this.nextPictureBox)).EndInit();
        this.ResumeLayout(false);

    }
}

